const { json } = require('body-parser');
// 显示修改用户模块

// 引入Article规则模块
const Article = require('../../model/article.js');
module.exports = async (req, res, next) => {
    let { id, page } = req.query;
    try {
        // 根据id查询文章
        let result = await Article.findOne({ _id: id }).populate('writer');
        result = JSON.stringify(result);
        result = JSON.parse(result);
        // 渲染文章编辑页面
        res.render('admin/article-edit', { article: result, page: page });
    } catch (error) {
        next(error);
    }
    
}